package com.kotlin.kotlindemo

import android.app.Application
import com.orhanobut.logger.AndroidLogAdapter
import com.orhanobut.logger.Logger
import com.orhanobut.logger.PrettyFormatStrategy


/**
 * Created by zhanghs on 2017/7/12.
 */

class XApplication : Application() {
    override fun onCreate() {
        super.onCreate()
        initConfig()
    }

    private fun initConfig() {
        initLogger()
    }

    private fun initLogger() {
        val formatStrategy = PrettyFormatStrategy.newBuilder()
                .showThreadInfo(false)  // (Optional) Whether to show thread info or not. Default true
                .methodCount(0)         // (Optional) How many method line to show. Default 2
                .methodOffset(7)        // (Optional) Hides internal method calls up to offset. Default 5
                .tag("kotlin")   // (Optional) Global tag for every log. Default PRETTY_LOGGER
                .build()

        Logger.addLogAdapter(AndroidLogAdapter(formatStrategy))
//        Logger.addLogAdapter(AndroidLogAdapter())
        Logger.d("hello %s", "world")
        Logger.d("debug")
        Logger.e("error")
        Logger.w("warning")
        Logger.v("verbose")
        Logger.i("information")
        Logger.wtf("wtf!!!!")
    }

}
